package com.security.door.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.security.door.core.base.BaseService;
import com.security.door.dao.mapper.crPersioninfoMapper;
import com.security.door.model.domain.crPersioninfo;
import com.security.door.model.dto.crPersioninfoDto;
import com.security.door.model.vo.crPersionAreaVo;
import com.security.door.service.IcrPersioninfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class crPersioninfoServiceImpl extends BaseService<crPersioninfo> implements IcrPersioninfoService {
    @Autowired
    crPersioninfoMapper icrPersioninfoMapper;

    @Override
    public PageInfo<crPersioninfo> queryListWithPage(crPersioninfoDto entity) {
        PageHelper.startPage(entity.getPageIndex(), entity.getPageSize());
        var actionList = icrPersioninfoMapper.queryListWithPage(entity);
        return new PageInfo<>(actionList);
    }

    public boolean hasExists(String persionCode) {
        return icrPersioninfoMapper.hasExists(persionCode) > 0 ? true : false;
    }

    public int deleteByIds(String guids) {
        return icrPersioninfoMapper.deleteByIds(guids);
    }

    public crPersionAreaVo selectByAreaCode(String persionCode) {
        return icrPersioninfoMapper.selectByAreaCode(persionCode);
    }

    public List<crPersioninfo> selectByAttenGroup(String attenGroup) {
        return icrPersioninfoMapper.selectByAttenGroup(attenGroup);
    }

    public List<crPersioninfo> selectAll(String attenGroup) {
        return icrPersioninfoMapper.selectAll();
    }

    public Integer clearAttenGroup(String attenGroup) {
        return icrPersioninfoMapper.clearAttenGroup(attenGroup);
    }

    public Integer updateAttenGroup(String attenGroup, String persionCodes) {
        this.clearAttenGroup(attenGroup);
        return icrPersioninfoMapper.updateAttenGroup(attenGroup, persionCodes);
    }
}
